
using System;
using System.Data;

namespace stefc.geo.data.model
{

	public class Contact : Entity
	{
		private int id;
		private string name;
		private string jid;
		private int level;

		public static Contact Create(string name, string jid)
		{
			Contact result = new Contact();
			result.Name=name;
			result.JId=jid;
			return result;
		}
		
		private Contact():base()
		{
		}
		
		public Contact (IDataReader reader):this()
		{
			int ord=reader.GetOrdinal("Id");
			this.id=reader.GetInt32(ord);
			ord=reader.GetOrdinal("Name");
			if(!reader.IsDBNull(ord))
				this.name=reader.GetString(ord);
			ord=reader.GetOrdinal("JId");
			if(!reader.IsDBNull(ord))
				this.jid=reader.GetString(ord);
			ord=reader.GetOrdinal("Level");
			if(!reader.IsDBNull(ord))
				this.level=reader.GetInt32(ord);
		}
		
		public int Id
		{
			get { return this.id; }
			internal set { this.id = value; }
		}
		
		public string Name
		{
			get { return this.name; }
			set { 
				if(value!=this.name)
				{
					this.name=value;
					this.Modifiy();
				}
			}
		}
		
		public string JId
		{
			get { return this.jid; }
			set { 
				if(value!=this.jid)
				{
					this.jid=value;
					this.Modifiy();
				}
			}
		}
		
		public int Level
		{
			get { return this.level; }
			set { 
				if(value!=this.level)
				{
					this.level=value;
					this.Modifiy();
				}
			}
		}
	}
}
